package com.imooc.pan.file.feignservice;

import com.imooc.pan.file.entity.RPanUserFile;
import com.imooc.pan.share.entity.RPanUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author Janson
 * @Description 用户存储已使用情况更新接口
 * @Date 2023/8/7
 */
@Component
@FeignClient(value = "ytupan-auth", fallbackFactory = UserStorageServiceFallbackFactory.class)
public interface UserStorageServiceClient {
    @GetMapping("/user/addUserStorageUsed")
    public String addUserStorageUsed(@RequestParam("userId") Long userId,
                                      @RequestParam(value = "fileSizeDesc", required = false) String fileSizeDesc,
                                      @RequestParam("folderFlag") Integer folderFlag);
    
    @GetMapping("/user/isFull")
    public String isFull(@RequestParam("userId") Long userId,
                          @RequestParam(value = "fileSizeDesc", required = false) String fileSizeDesc,
                          @RequestParam("folderFlag") Integer folderFlag);
    
    @PostMapping("/user/substracrStorageUsed")
    public void substracrStorageUsed(@RequestParam("userId") Long userId, @RequestBody() List<RPanUserFile> reconds);
    
    @GetMapping("/user/getUserInfoById")
    public RPanUser getUserInfo(@RequestParam("userId") Long userId);
}
